/* This dofile plots map of study sample */


* open original shape file 
shp2dta using "$raw/map/btn_admbnda_adm1_bnlc_20201026.shp", database("$temp/bhutan2") ///
coordinates("$temp/bhutan2_coord") gencentroids(centroid) genid(id) replace

import excel "$raw/map/randomization_school_location.xlsx", sheet("stem") firstrow clear
rename treat_273293 treatment
lab def treatment1 0 "control school" 1 "treatment school"  99 "STEM colleges", modify
lab val treatment treatment1
save "$temp/STEM_location.dta", replace 

import excel "$raw/map/randomization_school_location.xlsx", sheet("tvet") firstrow clear
rename treat_387432 treatment
lab def treatment2 0 "control school" 1 "treatment school" 99 "TVET institutes", modify
lab val treatment treatment2
save "$temp/TVET_location.dta", replace 


use "$temp/bhutan2", clear
rename id _ID

foreach group in STEM TVET {
	spmap using "$temp/bhutan2_coord.dta", id(_ID) ///
		point(data("$temp/`group'_location") xcoord(lon) ycoord(lat) ///
		by(treatment) fcolor(navy cranberry green) shape(S C T) size(*0.5 *0.5 *0.5) ///
		legenda(on)) fc(white) name(`group', replace) ///
		subtitle("Study Sample, `group' Mentoring Program") /// 
		legend(ring(1) position(1) size(medsmall)) plotregion(margin(small) color(white)) ///
		label(data("$temp/bhutan2") x(x_centroid) y(y_centroid) label(ADM1_EN) color(black) size(2) length(20))
}

gr combine STEM TVET, c(1) r(2) xsize(1) ysize(1.4) ///
    plotregion(margin(small) color(white))   ///
    graphregion(fcolor(white) lcolor(white)) 
	
gr export "$tabfig/map.png", as(png) replace


